package cn.edu.ecnu.gis.client.model;

import java.util.ArrayList;
import java.util.List;

public abstract class GadgetClass {

    private String name;
    private boolean refreshable;
    private ArrayList userprefs = new ArrayList();
    private int gadgetType = 0;
    private static List classes = new ArrayList();

    public static void addClass(GadgetClass gclass) {
        classes.add(gclass);

    }

    public static List getClasses() {
        return classes;
    }

    public GadgetClass(String n, boolean r) {
        name = n;
        refreshable = r;
    }

    public abstract Gadget newGadget();

    public boolean isRefreshable() {
        return refreshable;
    }

    public String getName() {
        return name;
    }

    public int getUserPrefsCount() {
        return userprefs.size();
    }

    public UserPref getUserPref(int pos) {
        return (UserPref) userprefs.get(pos);
    }

    protected void addUserPref(UserPref up) {
        userprefs.add(up);
    }

    public int getGadgetType() {
        return gadgetType;
    }

    public void setGadgetType(int gadgetType) {
        this.gadgetType = gadgetType;
    }
}
